package red.mlz.module.module.sms.mapper;


import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import red.mlz.module.module.sms.entity.SmsCrond;

import java.math.BigInteger;
import java.util.List;

/**
 * <p>
 * 定时任务短信表 Mapper 接口
 * </p>
 *
 * @author mlzred
 * @since 2025-04-07
 */
public interface SmsCrondMapper  {

    @Select("select * from sms_crond WHERE id=#{id} and is_deleted = 0")
    SmsCrond getById(@Param("id") BigInteger id);

    @Select("select * from sms_crond WHERE id=#{id}")
    SmsCrond extractById(@Param("id") BigInteger id);

    int update(@Param("SmsCrond") SmsCrond smsCrond);

    int insert(@Param("SmsCrond") SmsCrond smsCrond);

    @Update("update sms_crond set is_deleted=1, update_time=#{time} where id=#{id} limit 1")
    void delete(@Param("id") BigInteger id, @Param("time") Integer time);

    @Select("select * from sms_crond WHERE status=#{status} limit 5")
    List<SmsCrond> listByStatus(@Param("status") Integer status);

    int updateBatch(@Param("smsCrondList")List<SmsCrond> smsCrondList);
}
